VERSION 5.00
Object = "{736A8444-E374-41A8-B526-1B07FD2F3F5B}#1.0#0"; "BLacKPeaRLOCX.ocx"
Begin VB.Form FrmBackup 
   BackColor       =   &H00000000&
   BorderStyle     =   0  'None
   Caption         =   "Backup Database"
   ClientHeight    =   2160
   ClientLeft      =   0
   ClientTop       =   30
   ClientWidth     =   4320
   Icon            =   "FrmBackup.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2160
   ScaleWidth      =   4320
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin BLacKPeaRLOCX.BLacKFrame c 
      Height          =   2175
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   4335
      _ExtentX        =   7646
      _ExtentY        =   3836
      BackColor1      =   0
      BackColor2      =   4210752
      Caption         =   "Backup/Restore Databases"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   49152
      TitleColor1     =   0
      TitleColor2     =   4210752
      TitleGradient   =   2
      TitleHeight     =   350
      BorderColor     =   49152
      BorderWidth     =   2
      Begin BLacKPeaRLOCX.ButtonNix cmdcls 
         Height          =   375
         Left            =   840
         TabIndex        =   8
         Top             =   1680
         Width           =   3255
         _ExtentX        =   5741
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Clear Cache"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   1184274
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmBackup.frx":B532
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin BLacKPeaRLOCX.ButtonNix cmdrestore 
         Height          =   375
         Left            =   1920
         TabIndex        =   7
         Top             =   1200
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Restore"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   1184274
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmBackup.frx":B54E
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin BLacKPeaRLOCX.ButtonNix cmdfind 
         Height          =   375
         Left            =   3480
         TabIndex        =   6
         Top             =   600
         Width           =   495
         _ExtentX        =   873
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "..."
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   1184274
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmBackup.frx":B56A
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin VB.TextBox TxtFold 
         BackColor       =   &H00404040&
         BorderStyle     =   0  'None
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H0000C000&
         Height          =   250
         Left            =   1110
         TabIndex        =   0
         Top             =   645
         Width           =   2055
      End
      Begin BLacKPeaRLOCX.ButtonNix CmdBackup 
         Height          =   375
         Left            =   840
         TabIndex        =   1
         Top             =   1200
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Backup"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   1184274
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmBackup.frx":B586
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin BLacKPeaRLOCX.ButtonNix CmdBatal 
         Height          =   375
         Left            =   3000
         TabIndex        =   2
         Top             =   1200
         Width           =   975
         _ExtentX        =   1720
         _ExtentY        =   661
         BTYPE           =   5
         TX              =   "Tutup"
         ENAB            =   -1  'True
         BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         COLTYPE         =   2
         FOCUSR          =   0   'False
         BCOL            =   1184274
         BCOLO           =   16777215
         FCOL            =   49152
         FCOLO           =   49152
         MCOL            =   12632256
         MPTR            =   1
         MICON           =   "FrmBackup.frx":B5A2
         UMCOL           =   -1  'True
         SOFT            =   0   'False
         PICPOS          =   0
         NGREY           =   0   'False
         FX              =   0
         HAND            =   0   'False
         CHECK           =   0   'False
         VALUE           =   0   'False
      End
      Begin VB.Shape Shape2 
         BackColor       =   &H00004040&
         BackStyle       =   1  'Opaque
         BorderColor     =   &H00C0FFC0&
         Height          =   345
         Left            =   1080
         Shape           =   4  'Rounded Rectangle
         Top             =   600
         Width           =   2130
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "* Lokasi yang di pilih tidak boleh ada spasi"
         ForeColor       =   &H0000C000&
         Height          =   315
         Left            =   240
         TabIndex        =   5
         Top             =   960
         Width           =   3090
      End
      Begin VB.Label Label1 
         Alignment       =   2  'Center
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Location"
         ForeColor       =   &H0000C000&
         Height          =   195
         Left            =   240
         TabIndex        =   4
         Top             =   600
         Width           =   645
      End
   End
End
Attribute VB_Name = "FrmBackup"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Declare Function ShellExecute Lib "shell32.dll" Alias _
        "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation _
        As String, ByVal lpFile As String, ByVal lpParameters _
        As String, ByVal lpDirectory As String, ByVal nShowCmd _
        As Long) As Long
Dim userdatadbc As String
Dim passworddbc As String
Dim tabledbc As String



Private Sub CmdBackup_Click()
On Error GoTo hell
Open App.path & "\backup.bat" For Output As #1
Dim Dos As String
Dim Dos1 As String
Dim Dos2 As String
Dim Dos3 As String
Dos = "mkdir " & TxtFold.Text & "\" & Format(Now, "dd-mm-yyyy")
Dos3 = "mysqldump --opt --user=" & userdatadbc & " --password=" & passworddbc & " " & tabledbc & " >" & TxtFold.Text & "\" & Format(Now, "dd-mm-yyyy") & "\" & "black.sql"
Print #1, Dos
Print #1, Dos1
Print #1, Dos3
Close 1
Shell ("backup.bat"), vbHide + vbMinimizedFocus
MsgBox "Backup databases berhasil, lihat backup di " & TxtFold.Text, vbInformation, "Success"
IfNoErr:
Exit Sub
hell:
 TulisError Err.Description, Err.Number, "CmdBackup_click", Me.Name
Resume IfNoErr


End Sub
Private Sub CmdBackup_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
CmdBackup.ToolTipText = "Backup databases biliing"
End Sub

Private Sub CmdBatal_Click()
    Unload Me
End Sub

Private Sub CmdBatal_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
CmdBatal.ToolTipText = "Keluar dari tool backup"
End Sub

Private Sub cmdcls_Click()
On Error Resume Next
Kill App.path & "\backup.bat"
Kill App.path & "\restore.bat"
MsgBox "Cache data sudah di hapus.", vbInformation, "Deleted"
End Sub

Private Sub cmdfind_Click()
Dim FileName As String
    FileName = BrowseFolder("Select a folder")
    If FileName <> "" Then
        TxtFold.Text = FileName
    End If
End Sub

Private Sub cmdrestore_Click()
'On Error GoTo hell
If MsgBox("Anda yakin akan merestore databases anda??? command ini akan mengembalikan databases anda sesuai dengan data yang anda pilih.", vbInformation + vbYesNo, "Restoration Data") = vbNo Then
Unload Me
Else
Open App.path & "\restore.bat" For Output As #1
Dim Dos As String
Dos = "mysql --user " & userdatadbc & " --password=" & passworddbc & " " & tabledbc & " <" & TxtFold.Text & "\" & "black.sql"
Print #1, Dos
Close 1
Shell ("restore.bat"), vbHide + vbMinimizedFocus
MsgBox "Data berhasil di restore. jalankan billing kembali untuk melihat hasilnya.", vbInformation, "Success"
End
End If
'IfNoErr:
'Exit Sub
'hell:
' TulisError Err.Description, Err.Number, "CmdBackup_click", Me.Name
'Resume IfNoErr

End Sub

Private Sub Form_Load()
userdatadbc = FrmDatabases.TxtUser.Text
passworddbc = FrmDatabases.txtpass.Text
tabledbc = FrmDatabases.txtnameda.Text
StyleS
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next


End Sub
Private Sub StyleS()
On Error Resume Next
Dim ctrl As Control
For Each ctrl In Controls
If FrmStyles.txtnamastyle.Text = "Default" Then
Exit Sub
Else
    If (TypeOf ctrl Is ButtonNix) And _
        ctrl.Name <> "cmdSwitchStyle" Then
        ctrl.ButtonType = FrmStyles.txtlButtonType.Text
        ctrl.ColorScheme = FrmStyles.txtlColorScheme.Text
        ctrl.Backcolor = FrmStyles.txtlBackcolor.Text
        ctrl.BackOver = FrmStyles.txtlBackOver.Text
        ctrl.Forecolor = FrmStyles.txtlForecolor.Text
        ctrl.ForeOver = FrmStyles.txtlForeOver.Text
       
    End If
        If (TypeOf ctrl Is BLacKFrame) And _
        ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.BackColor1 = FrmStyles.frameBackColor1.Text
         ctrl.BackColor2 = FrmStyles.frameBackColor2.Text
         ctrl.BorderColor = FrmStyles.frameBorderColor.Text
         ctrl.Forecolor = FrmStyles.frameForecolor.Text
         ctrl.TitleColor1 = FrmStyles.frameTitleColor1.Text
         ctrl.TitleColor2 = FrmStyles.frameTitleColor2.Text
         If FrmStyles.frameBackGradient.Text = 0 Then
         ctrl.BackGradient = None
         ElseIf FrmStyles.frameBackGradient.Text = 1 Then
         ctrl.BackGradient = Vertical
         ElseIf FrmStyles.frameBackGradient.Text = 2 Then
         ctrl.BackGradient = Horizontal
         End If
         
         If FrmStyles.Frametitlegradient.Text = 0 Then
         ctrl.TitleGradient = None
         ElseIf FrmStyles.Frametitlegradient.Text = 1 Then
         ctrl.TitleGradient = Vertical
         ElseIf FrmStyles.Frametitlegradient.Text = 2 Then
         ctrl.TitleGradient = Horizontal
         End If

    End If
        If (TypeOf ctrl Is BLacKText) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.TForecolor.Text
         ctrl.Backcolor = FrmStyles.TBackcolor.Text
         ctrl.BackColorMain = FrmStyles.TBackColorMain.Text
         ctrl.BorderColor = FrmStyles.TBorderColor.Text
         ctrl.FocusBackColor = FrmStyles.TFocusBackColor.Text
         ctrl.FocusBackMainColor = FrmStyles.TFocusBackMainColor.Text
         ctrl.FocusBorderColor = FrmStyles.TFocusBorderColor.Text
         ctrl.FocusForeColor = FrmStyles.TFocusForeColor.Text
    End If
        If (TypeOf ctrl Is MSFlexGrid) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.GDBackcolor.Text
         ctrl.BackColorBkg = FrmStyles.GDBackColorBkg.Text
         ctrl.BackColorSel = FrmStyles.GDBackColorSel.Text
         ctrl.BackColorFixed = FrmStyles.GDBackColorFixed.Text
         ctrl.ForeColorSel = FrmStyles.GDForeColorSel.Text
         ctrl.Forecolor = FrmStyles.GDForecolor.Text
         ctrl.ForeColorFixed = FrmStyles.GDForeColorFixed.Text
         ctrl.GridColor = FrmStyles.GDGridColor.Text
         ctrl.GridColorFixed = FrmStyles.GDGridColorFixed.Text
    End If
        If (TypeOf ctrl Is TextBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.lbltextfore.Text
         ctrl.Backcolor = FrmStyles.lbltextback.Text
    End If
        If (TypeOf ctrl Is ComboBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.cboForeColor.Text
         ctrl.Backcolor = FrmStyles.cboBackcolor.Text
    End If
        If (TypeOf ctrl Is Label) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.lblForeColor.Text
    End If
        If (TypeOf ctrl Is RichTextBox) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.RcBackcolor.Text
    End If
    
            If (TypeOf ctrl Is OptionButton) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Forecolor = FrmStyles.opForecolor.Text
         ctrl.Backcolor = FrmStyles.opBackcolor.Text
    End If
            If (TypeOf ctrl Is ListView) And _
         ctrl.Name <> "cmdSwitchStyle" Then
         ctrl.Backcolor = FrmStyles.LBackColor.Text
    End If
    Me.Backcolor = FrmStyles.WFore.Text
    End If
Next ctrl
End Sub
Private Sub TxtFold_Change()
TxtFold.Backcolor = &H0&
TxtFold.Forecolor = vbWhite
End Sub
Private Sub TxtFold_LostFocus()
TxtFold.Backcolor = &H404040
TxtFold.Forecolor = &HC000&
End Sub

